d30ccff2996e188b43d79f3ab27d68324e39b4d9,src/main/java/plugin/Stitching_Grid.java,Stitching_Grid,getLayoutFromMultiSeriesFile,#String#number#boolean#boolean#boolean#boolean#Downsampler#,835

Before Change



			final int numSeries = r.getSeriesCount();
			
			if ( IJ.debugMode )
				IJ.log( "numSeries:  " + numSeries );
			
			// get maxZ
			int dim = 2;
			for ( int series = 0; series < numSeries; ++series )
				if ( r.getSizeZ() > 1 )
					dim = 3;

			if ( IJ.debugMode )
				IJ.log( "dim:  " + dim );

			final MetadataRetrieve retrieve = service.asRetrieve(r.getMetadataStore());
			if ( IJ.debugMode )
				IJ.log( "retrieve:  " + retrieve );

			// CTR HACK: In the case of a single series, we treat each time point
			// as a separate series for the purpose of stitching tiles.
			timeHack = numSeries == 1;

			for ( int series = 0; series < numSeries; ++series )
			{
				if ( IJ.debugMode )
					IJ.log( "fetching data for series:  " + series );
				r.setSeries( series );

				final int sizeT = r.getSizeT();
				if ( IJ.debugMode )
					IJ.log( "sizeT:  " + sizeT );

				final int maxT = timeHack ? sizeT : 1;

				for ( int t = 0; t < maxT; ++t )
				{
					double[] location =
						CommonFunctions.getPlanePosition( r, retrieve, series, t, invertX, invertY, ignoreZStage );
					double locationX = location[0];
					double locationY = location[1];
					double locationZ = location[2];

					if ( !ignoreCalibration )
					{
						// calibration
						double calX = 1, calY = 1, calZ = 1;
						PositiveFloat cal;
						final String dimOrder = r.getDimensionOrder().toUpperCase();

						final int posX = dimOrder.indexOf( 'X' );
						cal = retrieve.getPixelsPhysicalSizeX( series );
						if ( posX >= 0 && cal != null && cal.getValue().floatValue() != 0 )
							calX = cal.getValue().floatValue();

						if ( IJ.debugMode )
							IJ.log( "calibrationX:  " + calX );

						final int posY = dimOrder.indexOf( 'Y' );
						cal = retrieve.getPixelsPhysicalSizeY( series );
						if ( posY >= 0 && cal != null && cal.getValue().floatValue() != 0 )
							calY = cal.getValue().floatValue();

						if ( IJ.debugMode )
							IJ.log( "calibrationY:  " + calY );

						final int posZ = dimOrder.indexOf( 'Z' );
						cal = retrieve.getPixelsPhysicalSizeZ( series );
						if ( posZ >= 0 && cal != null && cal.getValue().floatValue() != 0 )
							calZ = cal.getValue().floatValue();

						if ( IJ.debugMode )
							IJ.log( "calibrationZ:  " + calZ );

						// location in pixel values;
						locationX /= calX;

After Change


						if ( posY >= 0 && cal != null && cal.getValue().floatValue() != 0 )
							calY = cal.getValue().floatValue();

						Log.debug( "calibrationY:  " + calY );

						final int posZ = dimOrder.indexOf( 'Z' );
						cal = retrieve.getPixelsPhysicalSizeZ( series );
						if ( posZ >= 0 && cal != null && cal.getValue().floatValue() != 0 )
							calZ = cal.getValue().floatValue();

						Log.debug( "calibrationZ:  " + calZ );

						// location in pixel values;
						locationX /= calX;